export default store => {
  console.log('store 初始化')
  // 如果本地存储了state 就将store中的state 替换掉
  if (localStorage.state) store.replaceState(JSON.parse(localStorage.state))
  // 执行mutation时会执行此方法
  store.subscribe((mutation, state) => {
    localStorage.state = JSON.stringify(state)
  })
}
